{extend name="OrderPublic/orderpublic"}
{block name="title"}订单管理{/block}
{block name="right"}
					<div class="user-order">

						<!--标题 -->
						<div class="am-cf am-padding">
							<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">订单管理</strong> / <small>Order</small></div>
						</div>
						<hr/>

						<div class="am-tabs am-tabs-d2 am-margin" data-am-tabs>

							<ul class="am-avg-sm-5 am-tabs-nav am-nav am-nav-tabs">
								<li class="am-active"><a href="#tab1">所有订单</a></li>
								<!-- <li><a href="#tab3">待发货</a></li>
								<li><a href="#tab4">待收货</a></li>
								<li><a href="#tab5">待评价</a></li> -->
							</ul>

							<div class="am-tabs-bd">
								<div class="am-tab-panel am-fade am-in am-active" id="tab1">
									<div class="order-top">
										<div class="th th-item">
											<td class="td-inner">商品</td>
										</div>
										<div class="th th-price">
											<td class="td-inner">单价</td>
										</div>
										<div class="th th-number">
											<td class="td-inner">数量</td>
										</div>
										<div class="th th-operation">
											<td class="td-inner">商品操作</td>
										</div>
										<div class="th th-amount">
											<td class="td-inner">合计</td>
										</div>
										<div class="th th-status">
											<td class="td-inner">交易状态</td>
										</div>
										<div class="th th-change">
											<td class="td-inner">交易操作</td>
										</div>
									</div>

									<div class="order-main">
										<div class="order-list">
											

											
											
											
									
											
											{foreach name="info" item="row"}
											<!--不同状态订单-->
											<div class="order-status3">
												<div class="order-title">
													<div class="dd-num">订单编号：<a href="javascript:;">{$row['ordernum']}</a></div>
													<span>{$row['time']}</span>
													<!--    <em>店铺：小桔灯</em>-->
												</div>
												<div class="order-content">
													<div class="order-left">

													{foreach name="row['pp']" item="rows"}
														<ul class="item-list">
															<li class="td td-item">
																<div class="item-pic">
																	<a href="#" class="J_MakePoint">
																		<img src="/uploads/{$rows['pic']}" class="itempic J_ItemImg">
																	</a>
																</div>
																<div class="item-info">
																	<div class="item-basic-info">
																		<a href="#">
																			<p>{$rows['goods_name']}</p>
																			<p class="info-little">
																				{$rows['descr']}
																			</p>
																		</a>
																	</div>
																</div>
															</li>
															<li class="td td-price">
																<div class="item-price">
																	{$rows['price']}
																</div>
															</li>
															<li class="td td-number">
																<div class="item-number">
																	<span>×</span>{$rows['qty']}
																</div>
															</li>
															<li class="td td-operation">
																<div class="item-operation">
																	<a href="refund.html">退款/退货</a>
																</div>
															</li>
														</ul>
														{/foreach}

														

													</div>
													<div class="order-right">
														<li class="td td-amount">
															<div class="item-amount">
																合计：{$row['allprice']}
																<p>含运费：<span>10.00</span></p>
															</div>
														</li>
														<div class="move-right">
															<li class="td td-status">
																<div class="item-status">
																	<p class="Mystatus">{switch name="$row['status']"}
																	{case value="0"}未发货{/case}
																	{case value="1"}已发货{/case}
    																{case value="2"}已收货{/case}
    																{case value="3"}取消中{/case}
    																{case value="4"}取消成功{/case}
    																{case value="5"}未发货{/case}
    																{case value="6"}未发货{/case}
    																{case value="7"}已评价{/case}
    																{default /}
																	{/switch}
																	</p>
																	<p class="order-info"><a href="/orderinfo/address/id/{$row['id']}">订单详情</a></p>
																</div>
															</li>
															<li class="td td-change">
															{if condition="$row['status']==1"}
																<a href=""><div class="am-btn am-btn-danger anniu shouhuo" name="{$row['id']}"></a>
																	确认收货
																	</div>
																<div class="am-btn am-btn-success anniu quxiao" name="{$row['id']}" style="margin-top:10px;">
																	取消订单
																	</div>
														{elseif condition="$row['status']==0"/}
																<div class="am-btn am-btn-danger anniu txfahuo" name="{$row['id']}" >
																	提醒发货
																	</div>
																	<div class="am-btn am-btn-success anniu quxiao" name="{$row['id']}" style="margin-top:10px;">
																	取消订单
																	</div>
														{elseif condition="$row['status']==2"/}
																<!--用户id=$row['user_id'] -->
																<a href="/orderinfo/doevaluate/orderid/{$row['id']}"><div class="am-btn am-btn-danger anniu " name="{$row['id']}" >
																	评价商品
																	</div></a>
																	<div class="am-btn am-btn-success anniu quxiao" name="{$row['id']}" style="margin-top:10px;">
																	取消订单
																	</div>
														{elseif condition="$row['status']==3"/}
																	<div class="am-btn am-btn-success anniu" name="{$row['id']}" style="margin-top:10px;">
																	取消中
																	</div>
														{elseif condition="$row['status']==4"/}
																	<div class="am-btn am-btn-success anniu" name="{$row['id']}" style="margin-top:10px;">
																	取消成功
																	</div>
														{elseif condition="$row['status']==5"/}
																	<div class="am-btn am-btn-danger anniu" name="{$row['id']}">
																	提醒中
																	</div>
																	<div class="am-btn am-btn-success anniu quxiao" name="{$row['id']}" style="margin-top:10px;">
																	取消订单
																	</div>
														{elseif condition="$row['status']==6"/}
																	<div class="am-btn am-btn-danger anniu" name="{$row['id']}">
																	提醒成功
																	</div>
																	<div class="am-btn am-btn-success anniu quxiao" name="{$row['id']}" style="margin-top:10px;">
																	取消订单
																	</div>
															{elseif condition="$row['status']==7"/}
																<!--用户id=$row['user_id'] -->
																<a href="javascript:void(0);"><div class="am-btn am-btn-success anniu " name="{$row['id']}" >
																	已评价
																	</div></a>
															{/if}
															</li>
														</div>
													</div>
												</div>

											</div>

										{/foreach}



										</div>

									</div>

								</div>
								
								


							</div>

						</div>
					</div>


<script>
	//确认收货
	$(".shouhuo").click(function(){
		ob=$(this);
		a=ob.attr("name");
		
		$.get("/orderinfo/queren",{a:a},function(data){
			 if(data==1){
			 	a=ob.parents("li").prev().find("div:eq(0)").find("p:eq(0)");
			 	a.html("已确认收货");
			 	ob.html("评价商品");	
			 }
		});
	})

	//取消订单
	$(".quxiao").click(function(){
		ob=$(this);
		a=ob.attr("name");
		//通过ajax更改状态
		$.get("/orderinfo/quxiao",{a:a},function(data){
			a=ob.parents("li").prev().find("div:eq(0)").find("p:eq(0)");
			a.html("取消中");
			ob.html("取消中");
			ob.prev().remove();


		})
	})
	//提醒发货
	$(".txfahuo").click(function(){
		ob=$(this);
		a=ob.attr("name");
		//通过ajax更改状态
		$.get("/orderinfo/txfahuo",{a:a},function(data){
			ob.html("提醒中");

		})
	})
</script>
{/block}